<template>
	<div class="select2Wrap">
		<div class="adToperBox">
			<div class="adToper flex-h">
				<span class="flex1 sp1">
					<!-- <svg-icon icon-class="college_icon_roll" /> -->
					<img class="imgIcon" src="~/static/iconsvgs/college_icon_roll.png" alt="">
					<b>院校介绍</b>
				</span>
				<span class="sp2" @click="clikcDesc('unviIndu')">
					<!-- <svg-icon icon-class="collage_icon_arrow_right" /> -->
					<img v-show="introductionStr" class="imgIcon" src="~/static/iconsvgs/collage_icon_arrow_right.png" alt="">
				</span>
			</div>
		</div>
		<div class="textBox">
			<span v-html="introductionStr?introductionStr:'暂无数据'"></span>
			<div v-if="videos===2">
				<video :src="descData.video" style="width: 6.9rem;height: 2rem;margin-top: 0.38rem;" controls="controls"></video>
			</div>

		</div>
		<div class="adToperBox">
			<div class="adToper flex-h">
				<span class="flex1 sp1">
					<!-- <svg-icon icon-class="college_icon_roll" /> -->
					<img class="imgIcon" src="~/static/iconsvgs/college_icon_roll.png" alt="">
					<b>招生简章</b>
				</span>
				<span class="sp2" @click="clikcDesc('desc')">
					<!-- <svg-icon icon-class="collage_icon_arrow_right" /> -->
					<img v-show="catalogStr" class="imgIcon" src="~/static/iconsvgs/collage_icon_arrow_right.png" alt="">
				</span>
			</div>
		</div>
		<div class="textBox">
			<span v-html="catalogStr?catalogStr:'暂无数据'"></span>

		</div>
		<div class="adToperBox">
			<div class="adToper flex-h">
				<span class="flex1 sp1">
					<!-- <svg-icon icon-class="college_icon_roll" /> -->
					<img class="imgIcon" src="~/static/iconsvgs/college_icon_roll.png" alt="">
					<b>院校动态</b>
				</span>
				<span class="sp2">

					<!-- <img class="imgIcon" src="~/static/iconsvgs/collage_icon_arrow_right.png" alt=""  @click="clikcDesc('dt')"> -->
				</span>
			</div>
		</div>
		<div style="padding-bottom: 0.3rem;">
			<img style="display: block;width: 3.5rem;height: 3.65rem;margin: 0.5rem auto 0.2rem;" src="~/static/icon/blank.png"
			 alt="">
			<span style="display: block;text-align: center;font-size: 0.3rem;">暂无数据</span>
		</div>
		<!-- 	<div class="dtBox">
			<span>不保证成功不一定有用，知识只是点亮世界的灵光，看见理想看见另一种可能</span>
			<b>2019-02-15</b>
		</div>
		<div class="dtBox">
			<span>不保证成功不一定有用，知识只是点亮世界的灵光，看见理想看见另一种可能</span>
			<b>2019-02-15</b>
		</div>
		<div class="dtBox">
			<span>不保证成功不一定有用，知识只是点亮世界的灵光，看见理想看见另一种可能</span>
			<b>2019-02-15</b>
		</div> -->
		<select-desc :showWho='whos' v-on:clearShowDesc="clearDesc" :showselect2='showsdesc' :unviInduData='descData.introduction'
		 :zsData="descData.catalog?descData.catalog:''"></select-desc>
	</div>
</template>

<script>
	import selectDesc from '~/components/selectNews2'
	import { profile } from "~/api/college";
	import ls from 'store2';
	export default {
		props: {

		},
		components: {
			selectDesc


		},
		data() {
			return {
				showsdesc: false,
				whos: '',
				descData: [],
				videos: 1,
				introductionStr: '',
				catalogStr: ''
			};
		},
		computed: {

		},
		mounted: function() {
			this.$vux.loading.show({
				text: '正在加载'
			})
			this.showUnivDetail()
		},
		methods: {
			isTerminal() {
				var u = navigator.userAgent;
				var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
				var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
				if (isAndroid) {
					return "isAndroid"
				} else if (isiOS) {
					return "isiOS"
				}
			},
			showAnBack() {
				if(this.isTerminal=='isAndroid'){
				if (window.history && window.history.pushState) {
					history.pushState(null, null, document.URL);
					window.addEventListener('popstate', this.fun, false); //false阻止默认事件
				}
				}
			},
			fun() {
				console.log('返回')
				this.showsdesc = false
				setTimeout(() => {
					this.removeback()
				}, 50)


			},
			removeback() {
				window.removeEventListener('popstate', this.fun, false);
			},
			clearDesc() {
				this.showsdesc = false
				this.removeback()
			},
			clikcDesc(sre) {
				this.whos = sre
				this.showsdesc = true;
				this.showAnBack()
			},
			showUnivDetail() {
				profile({
					"academyCode": ls.get('applsData').academyCode + "",
					"fromUser": ls.get('applsData').userId
				}).then(res => {
					if (res.code === '0') {

						if (res.data) {
							this.descData = res.data;
							this.introductionStr = this.descData.introduction;
							this.catalogStr = this.descData.catalog
						}

						if (res.data.video !== '') {
							this.videos = 2;
						}
						this.$vux.loading.hide();
					}

					console.log('resDetai', res)
				}).catch((error) => {
					this.$vux.toast.text('暂无数据');
					this.$vux.loading.hide();
				})
			}


		}
	};
</script>


<style scoped lang="less">
	.select2Wrap {
		width: 7.5rem;
		height: auto;
		background: #fff;
		padding-top: 0.2rem;

		.adToperBox,
		.textBox,
		.dtBox {
			width: 100%;
			padding: 0 0.3rem;
			box-sizing: border-box;
		}

		.adToperBox {

			height: 0.9rem;


			span {
				font-size: 0.28rem;
				line-height: 0.9rem;

				b {
					font-size: 0.34rem;
					font-weight: bold;
					color: rgba(34, 34, 34, 1);
					vertical-align: middle;
					margin-left: 0.1rem;
				}

				.imgIcon {
					width: 0.24rem;
					height: 0.24rem;
					vertical-align: middle;

				}
			}

			.sp1 {
				text-align: left;
			}

			.sp2 {


				width: 3rem;
				text-align: right;

				.imgIcon {
					vertical-align: middle;
					width: 0.4rem;
					height: 0.4rem;
				}


			}

		}

		.textBox {
			height: auto;

			span {
				font-size: 0.28rem;
				min-height: 1.2rem;
				font-weight: 500;
				color: rgba(153, 153, 153, 1);
				line-height: 0.4rem;
				display: -webkit-box;
				-webkit-line-clamp: 3;
				-webkit-box-orient: vertical;
				overflow: hidden;

			}
		}

		.dtBox {
			height: auto;
			padding-bottom: 0.3rem;
			padding-top: 0.2rem;
			border-bottom: 1px solid rgba(238, 238, 238, 1);

			span {
				font-size: 0.3;

				font-weight: bold;
				color: rgba(34, 34, 34, 1);
				line-height: 0.42rem;
			}

			b {
				display: block;

				font-size: 0.26rem;

				font-weight: 500;
				color: rgba(187, 187, 187, 1);
				text-align: right;
				margin-top: 0.15rem;
			}
		}
	}
</style>
